﻿@{
    Lang lang = ViewBag.Lang;
    ViewBag.Title = "Booking";
    int iAdult = @ViewBag.Adult;
    int iChild = @ViewBag.Child;
    int iBaby = @ViewBag.Baby;
    var tDepart = (TGVR_Boot.DTO.TicketDTO)ViewBag.tDepart;
    var tReturn = (TGVR_Boot.DTO.TicketDTO)ViewBag.tReturn;
    var iYear = DateTime.Now.Year;
}
<style>
    #f-info {
        width: 100%;
    }

    /*#f-info table tr td {
            border: 1px solid;
        }*/

    #flight-info {
        background: lavender;
        overflow: auto;
        line-height: 20px;
    }

        #flight-info .block.label {
            width: 17%;
        }

        #flight-info .block.detail {
            width: 32%;
        }

        #flight-info .block.img img, #flight-info .block.img {
            width: 70px;
        }

    #customer-info span {
        width: 77px;
        display: inline-block;
    }

    fieldset {
        padding: 10px 0;
    }

    #note-info textarea {
        width: 99%;
        border-color: lavender;
    }

    .f-time {
        font-size: 23px;
    }

    .div-info table tr td:first-child {
        width: 135px;
    }

    .div-info table tr td input[type="text"] {
        width: 97%;
    }

    .input {
        width: 97%;
        padding: 5px;
    }

    .errors {
        border: 1px solid red;
    }

    .blog {
        border-top: 1px solid #C8C8C8;
        padding: 5px;
    }
</style>
<div class="div-info boder-table">
    <table style="width: 100%;" border="1">
        <tr>
            <td>@lang.THEFILGHT:</td>
            <td>@if (tReturn != null)
                { @lang.TWOWAY }
                else
                { @lang.ONEWAY}</td>
        </tr>
        <tr>
            <td>@lang.AMOUNT:</td>
            <td>@ViewBag.Adult @lang.ADULT, @ViewBag.Child @lang.CHILD, @ViewBag.Baby @lang.BABY</td>
        </tr>
        <tr>
            <td>@lang.STARTDATE:</td>
            <td>@{
                if (ViewBag.DatePickerDepartDate != null)
                {
                    var DepartDate = ((DateTime)ViewBag.DatePickerDepartDate).ToString("dd/MM/yyyy");
                <span>@DepartDate</span>
                }
            }

            </td>
        </tr>
        <tr>
            <td>@lang.RETURNDATE:</td>
            <td>
                @{
                    if (ViewBag.DatePickerReturnDate != null)
                    {
                        var r = ((DateTime)ViewBag.DatePickerReturnDate).ToString("dd/MM/yyyy");
                    <span>@r</span>
                    }
                }

            </td>
        </tr>
        <tr>
            <td>@lang.FROMCITY</td>
            <td>@ViewBag.fromcity</td>
        </tr>
        <tr>
            <td>@lang.TOCITY</td>
            <td>@ViewBag.tocity</td>
        </tr>
    </table>
</div>


<div id="f-info">
    <form method="post" action="/flightsearch/checkout" onsubmit="return onValidate()">
        <h2>@lang.FLIGHTINFO</h2>

        <br />
        @Html.Partial("Partials/ListTicket")
        <h2>@lang.PASSENGER</h2>
        <div id="passenger-info">
            @{int index = 0;}
            @if (iAdult > 0)
            {
                <fieldset>
                    <legend>@lang.ADULT</legend>
                    @for (int i = 0; i < iAdult; i++)
                    {
                        
                        
                        <text>
                        <div class="combo-input clear">
                            <table style="width: 100%;">
                                <tr>
                                    <td class="div-info">
                                        <table style="width: 100%">
                                            <tr>
                                                <td>
                                                    @lang.SEX
                                                </td>
                                                <td>
                                                    <select name="Passenger[@index].Sex" required = "required">
                                                        <option value="M">@lang.MALE</option>
                                                        <option value="F">@lang.FEMALE</option>
                                                    </select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>@Html.Raw(lang.FIRSTNAMEMORE) <b style="color: red">*</b>
                                                </td>
                                                <td>
                                                    <input class="input" id="firstname1" name="Passenger[@index].FirstName" required = "required" onkeyup="onUpper()" onblur="onFinishName()"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>@Html.Raw(lang.NAMEMORE) <b style="color: red">*</b>
                                                </td>
                                                <td>
                                                    <input class="input" id="name1" name="Passenger[@index].Name" required = "required" onkeyup="onUpper1()" onblur="onFinishName()"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="display: none" class="div-info">
                                        <table style="width: 100%">
                                            <tr>
                                                <td>@lang.BIRTH
                                                    <input type="hidden" id="Birthday_@index" name="Birthday_@index" value="02/02/1990" />
                                                </td>
                                                <td>
                                                    <select>
                                                        <option>Ngày</option>
                                                        @{for (int j = 1; j <= 31; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                    <select>
                                                        <option>Tháng</option>
                                                        @{for (int j = 1; j <= 12; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                    <select>
                                                        <option>Năm</option>
                                                        @{
                                                          int year = DateTime.Now.Year;
                                                          for (int j = 1900; j <= year; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    @lang.ADDRESS
                                                </td>
                                                <td>
                                                    <input class="input" name="Passenger[@index].Address" value="90 La Xuan Oai, Quan 9, Tp Ho Chi Minh" required = "required" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>@lang.CITY
                                                </td>
                                                <td>
                                                    <input class="input" name="Passenger[@index].City" value="HCM" required = "required" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    @lang.PROVINE
                                                </td>
                                                <td>
                                                    <select name="Passenger[@index].TK_ProvineID" >
                                                        <option value="-1"></option>
                                                        <option value="10245">An Giang</option>
                                                        <option value="10246">Ba Ria - Vung Tau</option>
                                                        <option value="10249">Bac Giang</option>
                                                        <option value="10248">Bac Kan</option>
                                                        <option value="10247">Bac Lieu</option>
                                                        <option value="10250">Bac Ninh</option>
                                                        <option value="10251">Ben Tre</option>
                                                        <option value="10253">Binh Dinh</option>
                                                        <option value="10252">Binh Duong</option>
                                                        <option value="10254">Binh Phuoc</option>
                                                        <option value="10255">Binh Thuan</option>
                                                        <option value="10256">Ca Mau</option>
                                                        <option value="10258">Can Tho</option>
                                                        <option value="10257">Cao Bang</option>
                                                        <option value="10243">Da Nang</option>
                                                        <option value="10259">Dac Lak</option>
                                                        <option value="10260">Dac Nong</option>
                                                        <option value="10261">Dien Bien</option>
                                                        <option value="10262">Dong Nai</option>
                                                        <option value="10263">Dong Thap</option>
                                                        <option value="10264">Gia Lai</option>
                                                        <option value="10265">Ha Giang</option>
                                                        <option value="10266">Ha Nam</option>
                                                        <option value="10242">Ha Noi</option>
                                                        <option value="10267">Ha Tay</option>
                                                        <option value="10268">Ha Tinh</option>
                                                        <option value="10269">Hai Duong</option>
                                                        <option value="10270">Hai Phong</option>
                                                        <option value="10271">Hau Giang</option>
                                                        <option value="10241" selected>Ho Chi Minh City</option>
                                                        <option value="10272">Hoa Binh</option>
                                                        <option value="10244">Hue</option>
                                                        <option value="10273">Hung Yen</option>
                                                        <option value="10274">Khanh Hoa</option>
                                                        <option value="10275">Kien Giang</option>
                                                        <option value="10276">Kon Tum</option>
                                                        <option value="10277">Lai Chau</option>
                                                        <option value="10278">Lam Dong</option>
                                                        <option value="10279">Lang Son</option>
                                                        <option value="10280">Lao Cai</option>
                                                        <option value="10281">Long An</option>
                                                        <option value="10230">NA</option>
                                                        <option value="10282">Nam Dinh</option>
                                                        <option value="10283">Nghe An</option>
                                                        <option value="10284">Ninh Binh</option>
                                                        <option value="10285">Ninh Thuan</option>
                                                        <option value="10286">Phu Tho</option>
                                                        <option value="10287">Phu Yen</option>
                                                        <option value="10288">Quang Binh</option>
                                                        <option value="10289">Quang Nam</option>
                                                        <option value="10290">Quang Ngai</option>
                                                        <option value="10291">Quang Ninh</option>
                                                        <option value="10292">Quang Tri</option>
                                                        <option value="10293">Soc Trang</option>
                                                        <option value="10294">Son La</option>
                                                        <option value="10295">Tay Ninh</option>
                                                        <option value="10296">Thai Binh</option>
                                                        <option value="10297">Thai Nguyen</option>
                                                        <option value="10298">Thanh Hoa</option>
                                                        <option value="10299">Tien Giang</option>
                                                        <option value="10300">Tra Vinh</option>
                                                        <option value="10301">Tuyen Quang</option>
                                                        <option value="10302">Vinh Long</option>
                                                        <option value="10303">Vinh Phuc</option>
                                                        <option value="10304">Yen Bai</option>
                                                    </select>
                                                </td>

                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <input type="hidden" name="Passenger[@index].TK_CountryID" value="234"/>
                            <input type="hidden" name="Passenger[@index].TypeID" value="1" />
                        </div>
                        </text>
                                                          index++;
                    }
                </fieldset>
            }
            @if (iChild > 0)
            {
                <fieldset>
                    <legend>@lang.CHILD</legend>
                    @for (int i = 0; i < iChild; i++)
                    {
                        <div class="div-info">
                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        @lang.SEX
                                    </td>
                                    <td>
                                        <select name="Passenger[@index].Sex" required = "required">
                                            <option value="M">@lang.MALE</option>
                                            <option value="F">@lang.FEMALE</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>@Html.Raw(lang.FIRSTNAME) <b style="color: red">*</b>
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].FirstName" required = "required" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>@Html.Raw(lang.NAME) <b style="color: red">*</b>
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].Name" required = "required" />
                                    </td>
                                </tr>

                                <tr>
                            </table>

                            <table style="width: 100%">
                                <tr>
                                    <td colspan="2">@lang.BIRTH <b style="color: red">*</b>

                                        <input type="hidden" id="Birthday_@index" name="Birthday_@index" value="01/01/2011" />
                                        <br />

                                        <div class="search-group" style="padding: 5px; text-align: center;">
                                            <div class="item-search">
                                                <div>
                                                    <select id='Birthday_@(index + "d")'>
                                                        <option value="0">Ngày</option>
                                                        @{for (int j = 1; j <= 31; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="item-search" style="margin: 0px 5px;">
                                                <div>
                                                    <select id='Birthday_@(index + "m")'>
                                                        <option value="0">Tháng</option>
                                                        @{for (int j = 1; j <= 12; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </div>

                                            </div>
                                            <div class="item-search">

                                                <div>

                                                    <select id='Birthday_@(index + "y")'>
                                                        <option value="0">Năm</option>
                                                        @{
                                                          int year = DateTime.Now.Year;
                                                          for (int j = year - 11; j <= year; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </div>
                                            </div>
                                            <div style="clear: both"></div>
                                        </div>

                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>
                                        @lang.ADDRESS
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].Address" value="90 La Xuan Oai, Quan 9, Tp Ho Chi Minh" required = "required" />
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>@lang.CITY
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].City" value="HCM" required = "required" />
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>
                                        @lang.PROVINE
                                    </td>
                                    <td>
                                        <select name="Passenger[@index].TK_ProvineID" >
                                            <option value="-1"></option>
                                            <option value="10245">An Giang</option>
                                            <option value="10246">Ba Ria - Vung Tau</option>
                                            <option value="10249">Bac Giang</option>
                                            <option value="10248">Bac Kan</option>
                                            <option value="10247">Bac Lieu</option>
                                            <option value="10250">Bac Ninh</option>
                                            <option value="10251">Ben Tre</option>
                                            <option value="10253">Binh Dinh</option>
                                            <option value="10252">Binh Duong</option>
                                            <option value="10254">Binh Phuoc</option>
                                            <option value="10255">Binh Thuan</option>
                                            <option value="10256">Ca Mau</option>
                                            <option value="10258">Can Tho</option>
                                            <option value="10257">Cao Bang</option>
                                            <option value="10243">Da Nang</option>
                                            <option value="10259">Dac Lak</option>
                                            <option value="10260">Dac Nong</option>
                                            <option value="10261">Dien Bien</option>
                                            <option value="10262">Dong Nai</option>
                                            <option value="10263">Dong Thap</option>
                                            <option value="10264">Gia Lai</option>
                                            <option value="10265">Ha Giang</option>
                                            <option value="10266">Ha Nam</option>
                                            <option value="10242">Ha Noi</option>
                                            <option value="10267">Ha Tay</option>
                                            <option value="10268">Ha Tinh</option>
                                            <option value="10269">Hai Duong</option>
                                            <option value="10270">Hai Phong</option>
                                            <option value="10271">Hau Giang</option>
                                            <option value="10241" selected>Ho Chi Minh City</option>
                                            <option value="10272">Hoa Binh</option>
                                            <option value="10244">Hue</option>
                                            <option value="10273">Hung Yen</option>
                                            <option value="10274">Khanh Hoa</option>
                                            <option value="10275">Kien Giang</option>
                                            <option value="10276">Kon Tum</option>
                                            <option value="10277">Lai Chau</option>
                                            <option value="10278">Lam Dong</option>
                                            <option value="10279">Lang Son</option>
                                            <option value="10280">Lao Cai</option>
                                            <option value="10281">Long An</option>
                                            <option value="10230">NA</option>
                                            <option value="10282">Nam Dinh</option>
                                            <option value="10283">Nghe An</option>
                                            <option value="10284">Ninh Binh</option>
                                            <option value="10285">Ninh Thuan</option>
                                            <option value="10286">Phu Tho</option>
                                            <option value="10287">Phu Yen</option>
                                            <option value="10288">Quang Binh</option>
                                            <option value="10289">Quang Nam</option>
                                            <option value="10290">Quang Ngai</option>
                                            <option value="10291">Quang Ninh</option>
                                            <option value="10292">Quang Tri</option>
                                            <option value="10293">Soc Trang</option>
                                            <option value="10294">Son La</option>
                                            <option value="10295">Tay Ninh</option>
                                            <option value="10296">Thai Binh</option>
                                            <option value="10297">Thai Nguyen</option>
                                            <option value="10298">Thanh Hoa</option>
                                            <option value="10299">Tien Giang</option>
                                            <option value="10300">Tra Vinh</option>
                                            <option value="10301">Tuyen Quang</option>
                                            <option value="10302">Vinh Long</option>
                                            <option value="10303">Vinh Phuc</option>
                                            <option value="10304">Yen Bai</option>
                                        </select>
                                    </td>
                                    <input type="hidden" name="Passenger[@index].TK_CountryID" value="234"/>
                                </tr>
                            </table>
                            <input type="hidden" name="Passenger[@index].TypeID" value="2" />
                        </div>
                                                          index++;
                    }
                </fieldset>
            }
            @if (iBaby > 0)
            {
                <fieldset>
                    <legend>@lang.BABY</legend>
                    @for (int i = 0; i < iBaby; i++)
                    {
                        <text>
                        <div class="div-info">

                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        @lang.SEX
                                    </td>
                                    <td>
                                        <select name="Passenger[@index].Sex" required = "required">
                                            <option value="M">@lang.MALE</option>
                                            <option value="F">@lang.FEMALE</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td>@Html.Raw(lang.FIRSTNAME) <b style="color: red">*</b>
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].FirstName" required = "required" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>@Html.Raw(lang.NAME) <b style="color: red">*</b>
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].Name" required = "required" />
                                    </td>
                                </tr>
                            </table>

                            <table style="width: 100%">
                                <tr>
                                    <td colspan="2">@lang.BIRTH  <b style="color: red">*</b>

                                        <input type="hidden" id='Birthday_@index' name="Birthday_@index" value="02/01/2013" />

                                        <br />

                                        <div class="search-group" style="padding: 5px; text-align: center;">
                                            <div class="item-search">
                                                <div>
                                                    <select id ='Birthday_@(index + "d")'>
                                                        <option value="0">Ngày</option>
                                                        @{for (int j = 1; j <= 31; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="item-search" style="margin: 0px 5px;">
                                                <div>

                                                    <select id='Birthday_@(index + "m")'>
                                                        <option value="0">Tháng</option>
                                                        @{for (int j = 1; j <= 12; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>
                                                </div>

                                            </div>
                                            <div class="item-search">

                                                <div>

                                                    <select id='Birthday_@(index + "y")'>
                                                        <option value="0">Năm</option>
                                                        @{
                                                          int year = DateTime.Now.Year;
                                                          for (int j = year - 2; j <= year; j++)
                                                          {
                                                              if (j < 10)
                                                              {
                                                            <option>@("0" + j)</option>
                                                              }
                                                              else
                                                              {
                                                            <option>@j</option>
                                                              }
                                                          }
                                                        }
                                                    </select>

                                                </div>
                                            </div>
                                            <div style="clear: both"></div>
                                        </div>
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>
                                        @lang.ADDRESS
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].Address" value="90 La Xuan Oai, Quan 9, Tp Ho Chi Minh" required = "required" />
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>@lang.CITY
                                    </td>
                                    <td>
                                        <input class="input" name="Passenger[@index].City" value="HCM" required = "required" />
                                    </td>
                                </tr>
                                <tr style="display: none">
                                    <td>
                                        @lang.PROVINE
                                    </td>
                                    <td>
                                        <select name="Passenger[@index].TK_ProvineID" >
                                            <option value="-1"></option>
                                            <option value="10245">An Giang</option>
                                            <option value="10246">Ba Ria - Vung Tau</option>
                                            <option value="10249">Bac Giang</option>
                                            <option value="10248">Bac Kan</option>
                                            <option value="10247">Bac Lieu</option>
                                            <option value="10250">Bac Ninh</option>
                                            <option value="10251">Ben Tre</option>
                                            <option value="10253">Binh Dinh</option>
                                            <option value="10252">Binh Duong</option>
                                            <option value="10254">Binh Phuoc</option>
                                            <option value="10255">Binh Thuan</option>
                                            <option value="10256">Ca Mau</option>
                                            <option value="10258">Can Tho</option>
                                            <option value="10257">Cao Bang</option>
                                            <option value="10243">Da Nang</option>
                                            <option value="10259">Dac Lak</option>
                                            <option value="10260">Dac Nong</option>
                                            <option value="10261">Dien Bien</option>
                                            <option value="10262">Dong Nai</option>
                                            <option value="10263">Dong Thap</option>
                                            <option value="10264">Gia Lai</option>
                                            <option value="10265">Ha Giang</option>
                                            <option value="10266">Ha Nam</option>
                                            <option value="10242">Ha Noi</option>
                                            <option value="10267">Ha Tay</option>
                                            <option value="10268">Ha Tinh</option>
                                            <option value="10269">Hai Duong</option>
                                            <option value="10270">Hai Phong</option>
                                            <option value="10271">Hau Giang</option>
                                            <option value="10241" selected>Ho Chi Minh City</option>
                                            <option value="10272">Hoa Binh</option>
                                            <option value="10244">Hue</option>
                                            <option value="10273">Hung Yen</option>
                                            <option value="10274">Khanh Hoa</option>
                                            <option value="10275">Kien Giang</option>
                                            <option value="10276">Kon Tum</option>
                                            <option value="10277">Lai Chau</option>
                                            <option value="10278">Lam Dong</option>
                                            <option value="10279">Lang Son</option>
                                            <option value="10280">Lao Cai</option>
                                            <option value="10281">Long An</option>
                                            <option value="10230">NA</option>
                                            <option value="10282">Nam Dinh</option>
                                            <option value="10283">Nghe An</option>
                                            <option value="10284">Ninh Binh</option>
                                            <option value="10285">Ninh Thuan</option>
                                            <option value="10286">Phu Tho</option>
                                            <option value="10287">Phu Yen</option>
                                            <option value="10288">Quang Binh</option>
                                            <option value="10289">Quang Nam</option>
                                            <option value="10290">Quang Ngai</option>
                                            <option value="10291">Quang Ninh</option>
                                            <option value="10292">Quang Tri</option>
                                            <option value="10293">Soc Trang</option>
                                            <option value="10294">Son La</option>
                                            <option value="10295">Tay Ninh</option>
                                            <option value="10296">Thai Binh</option>
                                            <option value="10297">Thai Nguyen</option>
                                            <option value="10298">Thanh Hoa</option>
                                            <option value="10299">Tien Giang</option>
                                            <option value="10300">Tra Vinh</option>
                                            <option value="10301">Tuyen Quang</option>
                                            <option value="10302">Vinh Long</option>
                                            <option value="10303">Vinh Phuc</option>
                                            <option value="10304">Yen Bai</option>
                                        </select>
                                    </td>
                                    <input type="hidden" name="Passenger[@index].TK_CountryID" value="234"/>
                                </tr>

                            </table>

                            <input type="hidden" name="Passenger[@index].TypeID" value="3" />
                        </div>

                        </text>
                                                          index++;
                    }
                </fieldset>
            }
        </div>
        <input type="hidden" value="@index" id="CountPerson"/>
        <div id="customer-info" class="div-info">
            <h2>@lang.CUSTOMERINFO</h2>
            <table style="width: 100%;">
                <tr>
                    <td><span>@lang.NAME</span></td>
                    <td>
                        <input class="input" id="cusname" name="Booking.Name" value="" required="required" /></td>
                </tr>
                <tr>
                    <td>@lang.PHONE <b style='color: red'>*</b></td>
                    <td>
                        <input class="input" id="phone1" name="Booking.Phone" value="" required="required"
                            type="text" /></td>
                </tr>
                <tr>
                    <td><span>@lang.EMAIL <b style='color: red'>*</b></span></td>
                    <td>
                        <input class="input" name="Booking.Email" value="" required="required"
                            type="email" /></td>
                </tr>
                <tr>
                    <td><span>@lang.ADDRESS <b style='color: red'>*</b></span></td>
                    <td>
                        <input class="input" name="Booking.Address" value="90 La Xuan Oai, Quan 9, Tp Ho Chi Minh"
                            required="required" /></td>
                </tr>
            </table>


        </div>
        <div id="note-info">
            <h2>@lang.EXTRAINFO</h2>
            <textarea name="Booking.Note"></textarea>
        </div>
        <div class="clear">
            <input type="hidden" name="Booking.SessionID" value="@ViewBag.SessionID" />
            <button class="btn-index btn-8 btn-8c" type="submit" style="height: 30px; margin: 0; padding: 5px">@lang.COMPLETE</button>
        </div>
    </form>
</div>
@{
    int iPerson = Int32.Parse(ViewData["Adult"].ToString()) + Int32.Parse(ViewData["Child"].ToString());
    if (ViewData["DatePickerReturnDate"] != null)
    {
        iPerson *= 2;
    }
}
<div class="right r-margin5 r-selectedticket">

    <div class="block clear">
    </div>
    <div id="selectedticket" style="position: relative; top: 0px; right: 0px; border: 1px solid #C8C8C8; margin-top: 10px">
        <h2 style="margin-left:5px;">
            @lang.SELECTEDTICKET</h2>
        <div class="blog">
            <div class="select-out">
                <span class="l-label">@lang.OUTBOUND</span> <span class="l-price">@tDepart.Price.ToString("#,##0")</span>
            </div>
            @if (ViewData["DatePickerReturnDate"] != null)
            {
                <div class="select-in">
                    <span class="l-label">@lang.INBOUND</span> <span class="l-price">@tReturn.Price.ToString("#,##0")</span>
                </div>
            }
        </div>

        <div class="blog">
            <div>
                <span class="l-label">@lang.PAYMENTTYPE</span>
            </div>
            <div>
                <span class="l-label" style="font-size: 14px;">@lang.PAYATHOME</span>
                <span style="width: 105px; font-size: 16px" class="l-price" value="25000">
                    <input type="radio" id="PayAtHome" value="1" name="PaymentType" @(ViewBag.PaymentType == "1" ? "checked" : "") onclick="calprice()"/>
                    <span style="font-size: 12px; font-weight: normal">@(iPerson)x</span>25,000</span>
            </div>
            <div>
                <span class="l-label" style="font-size: 14px;">@lang.PAYATTGVR</span>
                <span style="width: 105px" class="l-price" value="0">
                    <input type="radio" name="PaymentType" value="2" @(ViewBag.PaymentType == "2" ? "checked" : "") onclick="calprice()"/>
                    0</span>
            </div>
        </div>

        <div class="blog">
            <div class="select-sum">
                <span class="l-label">@lang.SUM</span> <span class="l-price">0</span>
            </div>
        </div>
        <form id="submitBooking" method="post" action="/flightsearch/booking" onsubmit="return checkTickets()">
            <input type="hidden" name="SessionID" value="@ViewBag.Key"/>
            <input type="hidden" name="DepartTicket" id="DepartTicket" value="" />
            <input type="hidden" name="ReturnTicket" id="ReturnTicket" value="" />
        </form>
    </div>
</div>
<script>
    $('html, body').animate({
        scrollTop: $("#f-info").offset().top
    }, 2000);
    function calprice() {
        debugger;
        var p1 = $('.select-out .l-price').text().replace(/,/g, "");
        //alert(p1);
        var p2 = $('.select-in .l-price').text().replace(/,/g, "");
        var sum = p1 * 1 + p2 * 1;
        //sum = sum.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");.format("#,#*");

        var pay = $("#PayAtHome").attr("checked");
        var fee = 0;
        if (pay)
            fee = 25000*@(iPerson);
        sum += fee;

        $('.select-sum .l-price').html(addCommas(sum));
    }
    $(document).ready(function () {
        calprice();
    });

    function checkUnicode() {
        var inputs = $("form input:text");
        for (i = 0; i < inputs.length; i++) {
            
        }
        return true;
    }

    function onFinishName() {
        var firstname1 = $("#firstname1").val();
        var name1 = $("#name1").val();

        $("#cusname").val(firstname1 + " " + name1);
    }

    function onValidate() {
        var emails = $("input[type='email']");
        for (i = 0; i < emails.length; i++) {
            var text = $(emails[i]).val();
            if (text.indexOf('.') == -1) {
                $(emails[i]).focus();
                alert("Email không hợp lệ");
                return false;
            }
        }

        var phone = $("#phone1").val();

        if (phone.length != 10 && phone.length != 11) {
            $(emails[i]).focus();
            alert("Số điện thoại phải là 10 hoặc 11 kí tự");
            return false;
        }

        if(onSubmitForm() == false)
            return false;
        return true;
    }

    function onUpper() {
        var firstname1 = $("#firstname1").val();
        $("#firstname1").val(firstname1.toUpperCase());
    }

    function onUpper1() {
        var name1 = $("#name1").val(); ;
        $("#name1").val(name1.toUpperCase());
    }

    function validateDate(birth,day,month,year){
        clearError(day);
        clearError(month);
        clearError(year);
        var flag = true;
        var valDay = $(day).val();
        var valMonth = $(month).val();
        var valYear = $(year).val();
        if (valDay == 0 ) {
            $(day).addClass("errors");
            flag = false;
        }
        if (valMonth == 0) {
            $(month).addClass("errors");
            flag = false;
        }
        if (valYear == 0) {
            $(year).addClass("errors");
            flag = false;
        }
        if(flag){

            $(birth).val(valDay+"/"+valMonth+"/"+valYear);
        }
        return flag;
    }

    function clearError(fieldId) {
        $(fieldId).removeClass("errors");
    }

    function onSubmitForm(){
        debugger;
        var iAdult = '@ViewBag.Adult';
        var flag = true;
        var icount =$("#CountPerson").val();
        for (var i = iAdult; i < icount; i++) {
            if(validateDate("#Birthday_"+i,"#Birthday_"+i+"d","#Birthday_"+i+"m","#Birthday_"+i+"y") === false)
                flag= false;
        }
        return flag;
    }
</script>
